﻿Imports SACommon
Public Class frmUpdateOptions
    Private mUpdateOptionID As UpdateOption.UpdateOptionID
    Private mRuleValue As String
    ReadOnly Property UpdateOptionID As UpdateOption.UpdateOptionID
        Get
            Return mUpdateOptionID
        End Get
    End Property
    ReadOnly Property UpdateOptionValue As String
        Get
            Return mRuleValue
        End Get
    End Property
    Private Sub frmUpdateOptions_Load(sender As Object, e As EventArgs) Handles Me.Load
        lblInput.Visible = False
        txtInput.Visible = False

        UpdateOptionDescriptionsBindingSource.DataSource = UpdateOption.UpdateOptions
    End Sub
    Private Sub cmbUpdateOptions_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbUpdateOptions.SelectedIndexChanged
        lblInput.Visible = False
        txtInput.Visible = False
        txtInput.Text = ""
        Select Case cmbUpdateOptions.SelectedValue
            Case Is = UpdateOption.UpdateOptionID.UpdateIfOlderThan
                lblInput.Text = "Version:"
                lblInput.Visible = True
                txtInput.Visible = True
            Case Else
        End Select
    End Sub
    Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click
        mUpdateOptionID = 0
        mRuleValue = ""
        Me.Close()
    End Sub
    Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click
        mUpdateOptionID = cmbUpdateOptions.SelectedValue
        mRuleValue = txtInput.Text
        Me.Close()
    End Sub
End Class